#include <math.h>
unsigned short match;
unsigned int endNum;
unsigned long curCod;

char[] getWord(int start)
{
	unsigned int startnum = id[getNum(curCod)-1];	//gets first number of curCod which is the ID of the word (if curCod is 223 startnum will be 2)
	unsigned long i, s, e, ID, curElement, endNum;
	match = 1;
	if (start == -1)
	{	//if its scanning for an ID for the first time
		if (startnum == 1)
		{
			s = 0;
			e = ind[1];
		} else if (startnum == 9) {
			s = ind[7];
			e = sizeof(*words);
		} else {
			s = id[startnum];
			e = id[startnum+1];
		}
		for (i = s i <= e; i++)
		{
			ID = words(i).substring(0, words(i).indexof("|")) //words(index) is (for example) "2|a" 2 being the ID, "a" being the word, this line gets the ID
			if (curCod = ID)
			{
				curElement = i;
				endNum = t;	//when you click //next// it will start here so it wont find the same word over and over
				return words(i).substring(words(i).indexof("|") + 1, words(i).length - words(i).indexof("|") - 1) // this line gets the word if the indexs match
			}
		}
	} else {	//this is if its found a word and is looking for another one
		For i = (start + 1) To endNum
			ID = words(i).substring(0, words(i).indexof("|"))
			If curCod = ID Then
				curElement = i
				Return words(i).substring(words(i).indexof("|") + 1, words(i).length - words(i).indexof("|") - 1)
			End If
		Next
		return getWord(-1)
	}
	match = 0;
	return -1;	//if it doesnt find a word then dont change anything
}
